package action;

import java.util.Map;

import servise.UserService;

import dao.UserDao;

public class UserAction {
    private String name;
    private String password;
    private String sql;
	public UserAction(String name,String password) {
		super();
		this.name = name;
		this.password = password;
	}
	public int result(){
		if(checkNull()==0){
			return 4;
		}
		sql = "select password from user where name='"+name+"'";
		Map map = (new UserDao(sql)).doSelect();
		int result = (new UserService(password,map)).pat();
		return result;
	}
	public int checkNull(){
		if("".equals(name)){
			return 0;
		}
		if("".equals(password)){
			return 0;
		}
		return 1;
	}
    
}
